Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Public Class Reportes


    Shared Sub PrestamosCompletados(ByRef desde As SqlDateTime, ByRef hasta As SqlDateTime)
        FormPrincipal.CRV.DisplayGroupTree = False
        FormPrincipal.CRV.DisplayStatusBar = False
        FormPrincipal.CRV.ShowCloseButton = True
        FormPrincipal.CRV.Visible = True
        FormPrincipal.menuBuscar.Visible = True
        FormPrincipal.panelPrestamo1.Visible = True
        FormPrincipal.CRV.Dock = DockStyle.Fill
        FormPrincipal.dgvPrincipal.Visible = False
        FormPrincipal.btnVolver.Visible = True
        Dim con As New System.Data.SqlClient.SqlConnection
        Dim comand As System.Data.SqlClient.SqlCommand
        Dim adapter As System.Data.SqlClient.SqlDataAdapter
        Dim table As New DataTable
        Try
            con.ConnectionString = My.Settings.cadenaConexion
            con.Open()
            comand = con.CreateCommand
            comand.CommandText = "prestamos_devolverCompletados"
            comand.CommandType = CommandType.StoredProcedure
            With comand
                .Parameters.AddWithValue("@desde", desde)
                .Parameters.AddWithValue("@hasta", hasta)
            End With
            adapter = New System.Data.SqlClient.SqlDataAdapter(comand)
            adapter.Fill(table)
            Dim crystal As New CrystalDecisions.CrystalReports.Engine.ReportDocument
            crystal.Load("C:\Users\Dario\Desktop\bibliotecairesm\Biblioteca Iresm\Biblioteca Iresm\Reportes\PrestamosCompletados.rpt")
            crystal.SetDataSource(table)
            FormPrincipal.CRV.ReportSource = crystal
            con.Close()
        Catch ex As Exception
            MessageBox.Show("excepcion: " & ex.Message, "Mostrando Reporte")
        Finally
            con.Close()
        End Try
    End Sub

    Shared Sub MorososActuales()
        FormPrincipal.CRV.DisplayGroupTree = False
        FormPrincipal.CRV.DisplayStatusBar = False
        FormPrincipal.CRV.ShowCloseButton = True
        FormPrincipal.CRV.Visible = True
        FormPrincipal.menuBuscar.Visible = True
        FormPrincipal.panelPrestamo1.Visible = True
        FormPrincipal.CRV.Dock = DockStyle.Fill
        FormPrincipal.dgvPrincipal.Visible = False
        FormPrincipal.btnVolver.Visible = True
        Dim con As New System.Data.SqlClient.SqlConnection
        Dim comand As System.Data.SqlClient.SqlCommand
        Dim adapter As System.Data.SqlClient.SqlDataAdapter
        Dim table As New DataTable
        Try
            con.ConnectionString = My.Settings.cadenaConexion
            con.Open()
            comand = con.CreateCommand
            comand.CommandText = "prestamos_devolverMorosos"
            comand.CommandType = CommandType.StoredProcedure
            adapter = New System.Data.SqlClient.SqlDataAdapter(comand)
            adapter.Fill(table)
            Dim crystal As New CrystalDecisions.CrystalReports.Engine.ReportDocument
            crystal.Load("C:\Users\Dario\Desktop\bibliotecairesm\Biblioteca Iresm\Biblioteca Iresm\Reportes\MorososActuales.rpt")
            crystal.SetDataSource(table)
            FormPrincipal.CRV.ReportSource = crystal
            con.Close()
        Catch ex As Exception
            MessageBox.Show("excepcion: " & ex.Message, "Mostrando Reporte")
        Finally
            con.Close()
        End Try
    End Sub

    Shared Sub PrestamosAnulados(ByRef desde As SqlDateTime, ByRef hasta As SqlDateTime)
        FormPrincipal.CRV.DisplayGroupTree = False
        FormPrincipal.CRV.DisplayStatusBar = False
        FormPrincipal.CRV.ShowCloseButton = True
        FormPrincipal.CRV.Visible = True
        FormPrincipal.menuBuscar.Visible = True
        FormPrincipal.panelPrestamo1.Visible = True
        FormPrincipal.CRV.Dock = DockStyle.Fill
        FormPrincipal.dgvPrincipal.Visible = False
        FormPrincipal.btnVolver.Visible = True
        Dim con As New System.Data.SqlClient.SqlConnection
        Dim comand As System.Data.SqlClient.SqlCommand
        Dim adapter As System.Data.SqlClient.SqlDataAdapter
        Dim table As New DataTable
        Try
            con.ConnectionString = My.Settings.cadenaConexion
            con.Open()
            comand = con.CreateCommand
            With comand
                .CommandText = "prestamos_DevolverAnulados"
                .CommandType = CommandType.StoredProcedure
                .Parameters.AddWithValue("@desde", desde)
                .Parameters.AddWithValue("@hasta", hasta)
            End With


            adapter = New System.Data.SqlClient.SqlDataAdapter(comand)
            adapter.SelectCommand = comand
            adapter.Fill(table)
            Dim crystal As New CrystalDecisions.CrystalReports.Engine.ReportDocument
            crystal.Load("C:\Users\Dario\Desktop\bibliotecairesm\Biblioteca Iresm\Biblioteca Iresm\Reportes\PrestamosAnulados.rpt")
            crystal.SetDataSource(table)
            FormPrincipal.CRV.ReportSource = crystal
            con.Close()
        Catch ex As Exception
            MessageBox.Show("excepcion: " & ex.Message, "Mostrando Reporte")
        Finally
            con.Close()
        End Try
    End Sub

End Class
